#ifndef ALGO_4SO6M7N5

#define ALGO_4SO6M7N5

#include <vector>
#include <set>
#include "Matrix.h"
class PartialOrder;

namespace Algo
{

    std::vector<unsigned int> fittingByRobinson( Matrix &dissimilarityMatrix, Matrix &robinsonMatrix, double &delta , bool fast);
    /** 
     * @brief The answer false or a 16epsilon-compatible total order
     * 
     * @param m matrix
     * @param epsilon epsilon
     * @param partialOrder partial order
     * @param totalOrder - the total order we seek for
     * 
     * @return The answer false or a 16epsilon-compatible total order
     */
    bool refine( std::set<unsigned int> &X, Matrix *m, PartialOrder *partialOrder, 
        std::vector<unsigned int> &totalOrder, double epsilon, bool first, bool fast );

    /** 
	 * @brief This function calculates each x-admissible hole, and also if it is a "good" hole
	 * @param AH the list of holes for each x of Xo
	 * @param Xo is the list of elements for whom we have to calcule their lit of holes
	 * @param m - dissimilarity matrix
	 * @param maximalChain is the list of holes
	 * @return false if AH(x) = 0, else true
	 */
    //bool holesPerX(std::vector<std::vector<int> > &AH, std::vector<int> &Xo, Matrix &m, std::vector<int> &maximalChain, double epsilon);
    //void fillXij( std::vector<std::vector<std::set<int> > > &Xij, std::vector<int> &Xo, std::vector<std::vector<int> > &AH, std::vector<int> &maximalChain);
    //bool epsilonCompatibleFor1Element(int x, Matrix &m, std::vector<int> &maximalChain, unsigned int leftBoundIndex, double epsilon);
    //bool epsilonCompatibleFor2Elements(int x, int y, std::vector<int> &maximalChain, unsigned int holeX, unsigned int holeY, Matrix &m, int epsilon);
    
    std::vector<double> getDelta(const Matrix *m);

    Matrix TotalOrder2RobinsonMatrix(const Matrix &m, std::vector<unsigned int> totalOrder, double &delta );
}

#endif /* end of include guard: ALGO_4SO6M7N5 */
